<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      crossorigin="anonymous"
      integrity="sha384-FckWOBo7yuyMS7In0aXZ0aoVvnInlnFMwCv77x9sZpFgOonQgnBj1uLwenWVtsEj"
      href="https://lib.baomitu.com/font-awesome/4.7.0/css/font-awesome.css"
      rel="stylesheet"
    />
    <style>
      :root {
        --clr: #222327;
        --wh: 70px;
      }
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background-color: var(--clr);
      }
      .navigation {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 400px;
        height: 70px;
        background: #fff;
        border-radius: 10px;
      }
      .navigation ul {
        display: flex;
        padding: 0;
        margin: 0;
        width: 350px;
      }
      .navigation ul li {
        position: relative;
        list-style: none;
        width: var(--wh);
        height: var(--wh);
        z-index: 1;
      }
      .navigation ul li a {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        width: 100%;
        text-align: center;
        font-weight: 500;
        text-decoration: none;
      }
      .navigation ul li a .icon {
        position: relative;
        display: block;
        line-height: 74px;
        font-size: 1.5em;
        text-align: center;
        transition: 0.5s;
        color: var(--clr);
      }
      .navigation ul li.active a .icon {
        transform: translateY(-34px);
        color: #fff;
      }
      .navigation ul li a .text {
        position: absolute;
        color: var(--clr);
        font-size: 0.75em;
        font-weight: 500;
        transition: 0.5s;
        opacity: 0;
        transform: translateY(20px);
        font-family: "Segoe UI", Ubuntu, Cantarell, sans-serif;
      }
      .navigation ul li.active a .text {
        opacity: 1;
        transform: translateY(10px);
      }
      .navigation .indicator {
        box-sizing: border-box;
        position: absolute;
        top: -50%;
        width: 70px;
        height: 70px;
        border-radius: 50%;
        background: #29ff43;
        border: 6px solid var(--clr);
        transition: 0.5s;
      }
      .navigation .indicator::before {
        content: "";
        position: absolute;
        top: 50%;
        left: -22px;
        width: 20px;
        height: 20px;
        background-color: transparent;
        border-top-right-radius: 20px;
        box-shadow: 0px -10px 0 0 var(--clr);
      }
      .navigation .indicator::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -22px;
        width: 20px;
        height: 20px;
        background-color: transparent;
        border-top-left-radius: 20px;
        box-shadow: -1px -10px 0 0 var(--clr);
      }

      .navigation ul li:nth-child(1).active ~ .indicator {
        transform: translateX(calc(var(--wh) * 0));
      }
      .navigation ul li:nth-child(2).active ~ .indicator {
        transform: translateX(calc(var(--wh) * 1));
      }
      .navigation ul li:nth-child(3).active ~ .indicator {
        transform: translateX(calc(var(--wh) * 2));
      }
      .navigation ul li:nth-child(4).active ~ .indicator {
        transform: translateX(calc(var(--wh) * 3));
      }
      .navigation ul li:nth-child(5).active ~ .indicator {
        transform: translateX(calc(var(--wh) * 4));
      }
    </style>
  </head>
  <body>
    <div class="navigation">
      <ul>
        <li class="item active">
          <a href="###">
            <span class="icon">
              <i class="fa fa-home" aria-hidden="true"></i>
            </span>
            <span class="text">Home</span>
          </a>
        </li>
        <li class="item">
          <a href="###">
            <span class="icon">
              <i class="fa fa-user" aria-hidden="true"></i>
            </span>
            <span class="text">Profile</span>
          </a>
        </li>
        <li class="item">
          <a href="###">
            <span class="icon">
              <i class="fa fa-commenting" aria-hidden="true"></i>
            </span>
            <span class="text">Message</span>
          </a>
        </li>
        <li class="item">
          <a href="###">
            <span class="icon">
              <i class="fa fa-camera" aria-hidden="true"></i>
            </span>
            <span class="text">Photos</span>
          </a>
        </li>
        <li class="item">
          <a href="###">
            <span class="icon">
              <i class="fa fa-cog" aria-hidden="true"></i>
            </span>
            <span class="text">Setting</span>
          </a>
        </li>
        <div class="indicator"></div>
      </ul>
    </div>
    <script>
      const items = document.querySelectorAll("ul>li.item");
      function activeLink() {
        items.forEach((item) => {
          item.classList.remove("active");
          this.classList.add("active");
        });
      }
      items.forEach((item) => item.addEventListener("click", activeLink));
    </script>
  </body>
</html>
